<?php
(!defined('IN_TOA') || !defined('IN_ADMIN')) && exit('Access Denied!');
/*
	[天生创想] (C)2008-2011 515158 Inc.
	This is NOT a freeware, use is subject to license terms
    URL:http://www.515158.com/
*/

get_config_keytable("rewards_");
empty($do) && $do = 'list';
if ($do == 'edit') {
	$id = getGP('id','G','int');
	$blog = $db->fetch_one_array("SELECT * FROM ".DB_TABLEPRE."rewards  WHERE id = '$id'");
	include_once('template/edit.php');

} elseif ($do == 'save') {
	
	$savetype = getGP('savetype','P');
	$id = getGP('id','P','int');
	$user = getGP('user','P');
	$project = getGP('project','P');
	$rewardsdate = getGP('rewardsdate','P');
	$wagesmonth = getGP('wagesmonth_year','P')."-".getGP('wagesmonth_month','P');
	$rewardskey = getGP('rewardskey','P');
	$price = getGP('price','P');
	$content = getGP('content','P');	
	
	//主表信息
	$rewards = array(
		'user' => $user,
		'project' => $project,
		'rewardsdate' => $rewardsdate,
		'wagesmonth' => $wagesmonth,
		'rewardskey' => $rewardskey,
		'price' => $price,
		'content' => $content
	);
	update_db('rewards',$rewards, array('id' => $id));
	$content=$user.get_inc_log(1).$project.get_inc_log(1).$rewardsdate.get_inc_log(1).$wagesmonth.get_inc_log(1).$rewardskey.get_inc_log(1).$price.get_inc_log(1).$content.get_inc_log(1).$uid.get_inc_log(1).$date;
	$title='编辑奖惩记录';
	get_oa_log_dbadd($id,$content,$title,29,$_USER->id);
    goto_page('admin.php?ac=index&fileurl=rewards');

}

?>